﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using Evolution.Structure;
using System.IO;
using System.Windows.Controls;
using System.Windows.Media;

namespace GameProject.Converters
{
    class NationToImageConverter : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is String)
            {
                if (File.Exists(@"Images\Civ_Icons\civ_nations\" + (((String)value).ToLower().Replace(" ", "").Replace("-", "")) + ".jpg"))
                    return @"Images\Civ_Icons\civ_nations\" + (((String)value).ToLower().Replace(" ", "").Replace(" ", "").Replace("-","")) + ".jpg";
            }
                return @"Images\Civ_Icons\civ_nations\unknown.jpg";
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
